/**
 * 报表设计公司(2011)
 */
package com.reportgear.designer.action.attr;

import java.awt.event.ActionEvent;

import javax.swing.SwingUtilities;

import com.reportgear.core.swing.pane.base.JBaseDialog;
import com.reportgear.designer.action.ReportAction;
import com.reportgear.designer.pane.common.JCellExpandAttrPane;
import com.reportgear.report.context.ReportContext;
import com.reportgear.report.model.cell.DefaultCell;
import com.reportgear.report.view.JWorksheet;

/**
 * 扩展属性与父格
 * 
 * @version 1.0 2011-3-28
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since ANNCSR 2.0
 */
public class CellExpandAttrAction extends ReportAction {

	public CellExpandAttrAction() {
		setName("扩展与父格");
		// setSmallIcon(BaseUtils.readIcon("resources/images/m_file/new.png"));
	}

	public void actionPerformed(ActionEvent e) {
		JWorksheet sheet = ReportContext.INSTANCE.getCurrentWorkSheet();
		DefaultCell cell = sheet.getActiveCell();

		if (cell == null) {
			return;
		}

		JCellExpandAttrPane editorPane = new JCellExpandAttrPane();
		editorPane.populate(cell);

		int result = editorPane.showDialog(SwingUtilities.getWindowAncestor(sheet), "扩展属性", 300, 130);

		if (result == JBaseDialog.RESULT_OK) {
			editorPane.update(cell);
		}
	}
}
